﻿using System;

namespace LogikBug.Async.Tasks.Entities
{
	public class ActionModel : Model<Action>
	{
		public ActionModel(Action action) : base(action)
		{
		}

		public static ActionModel Create(Action action)
		{
			return new ActionModel(action);
		}

		public static ActionModel<T> Create<T>(T item, Action<T> action)
		{
			return new ActionModel<T>(item, action);
		}

		public static ActionModel<T1, T2> Create<T1, T2>(T1 item1, T2 item2, Action<T1, T2> action)
		{
			return new ActionModel<T1, T2>(item1, item2, action);
		}

		public virtual void Invoke()
		{
			Entity.Invoke();
		}
	}

	public class ActionModel<T> : Model<Action<T>>
	{
		public ActionModel(T item, Action<T> action) : base(action)
		{
			Item = item;
		}

		public T Item { get; set; }

		public void Invoke()
		{
			Entity.Invoke(Item);
		}
	}

	public class ActionModel<T1, T2> : Model<Action<T1, T2>>
	{
		public ActionModel(T1 item1, T2 item2, Action<T1, T2> action) : base(action)
		{
			Item1 = item1;
			Item2 = item2;
		}

		public T1 Item1 { get; set; }

		public T2 Item2 { get; set; }

		public void Invoke()
		{
			Entity.Invoke(Item1, Item2);
		}
	}
}
